<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.lmpop.trade.ti_aboutinfo.*" %>
<%@ page import="com.lmpop.trade.ti_aboutchannel.*" %>
<%@ page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Ti_aboutinfo ti_aboutinfo = new Ti_aboutinfo();
	String titlex = "";
	if(request.getParameter("searchTitle")!=null && !request.getParameter("searchTitle").equals("")){
		titlex = request.getParameter("searchTitle");
		ti_aboutinfo.setTitle(titlex);
	}
	
	String n_info_state = "";
	if(request.getParameter("abinfo_state")!=null && !request.getParameter("abinfo_state").equals("")){
		n_info_state = request.getParameter("abinfo_state");
		ti_aboutinfo.setState(n_info_state);
	}
	
	String n_ch_attr = "";
	if(request.getParameter("s_ch_attr")!=null && !request.getParameter("s_ch_attr").equals("")){
		n_ch_attr = request.getParameter("s_ch_attr");
		ti_aboutinfo.setCh_attr(n_ch_attr);		
	}
	
	Ti_aboutinfoInfo ti_aboutinfoInfo = new Ti_aboutinfoInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_aboutinfoInfo.getListByPage(ti_aboutinfo,Integer.parseInt(iStart),limit);
	int counter = ti_aboutinfoInfo.getCountByObj(ti_aboutinfo);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?s_ch_attr="+n_ch_attr+"&abinfo_state="+n_info_state+"&searchTitle="+titlex+"&iStart=",Integer.parseInt(iStart),limit);
	
	Ti_aboutchannelInfo ti_aboutchannelInfo = new Ti_aboutchannelInfo();
	String selt = ti_aboutchannelInfo.getSelaboutChannelByLevel("1");
	String para =	"s_ch_attr="+n_ch_attr+"&abinfo_state="+n_info_state+"&searchTitle="+titlex+"&iStart="+Integer.parseInt(iStart)+"&limit="+limit;
	//out.print(para);
%>
<html>
  <head>
    
    <title>信息管理</title>
		<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
		<script type='text/javascript' src='/dwr/interface/Ti_aboutchannelInfo.js'></script>
		<script type='text/javascript' src='/dwr/engine.js'></script>
		<script type='text/javascript' src='/dwr/util.js'></script>
		<script type="text/javascript" src="/js/commen.js"></script>
		<script type="text/javascript" src="aboutinfo.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>信息管理</h1>
			</td>
			<td>
				<a href="addInfo.jsp"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post" onsubmit="return false;">
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
	    <td align="left">
	    	信息名称:<input name="searchTitle" id="searchTitle" type="text" />&nbsp;&nbsp;
				信息状态:
				<select name="abinfo_state"  id="abinfo_state">
					<option value="">请选择</option>
					<option value="0">显示</option>
					<option value="1">隐藏</option>
				</select>&nbsp;&nbsp;
				所属栏目:
					  <select name="sort1" id="sort1" style="width:130px;" onChange="setSecondClass(this.value);">
          			<option value="">请选择</option>
          			<%=selt %>
            </select>
         
					  <select name="sort2" id="sort2" style="width:130px;display:none" onChange="setTherdClass(this.value);">
								<option value="">请选择</option>
						</select>
					
						<select name="sort3" id="sort3" style="width:130px;display:none" >
								<option value="">请选择</option>
						</select>
	    	<input name="s_ch_attr" id="s_ch_attr" type="hidden" value=""/>
	    	<input name="searchInfo" type="button" value="查询" onclick="searchForm()"/>
	    	
			</td>
	  </tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
		  	<th>信息名称</th>
		  	
		  	<th>所属栏目</th>
		  	
		  	<th>信息状态</th>
		  	
		  	<th>录入时间</th>
		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String info_id="",ch_attr="",title="",state="",in_datex="";
  			  	if(map.get("info_id")!=null) info_id = map.get("info_id").toString();
				  	if(map.get("ch_attr")!=null) ch_attr = map.get("ch_attr").toString();
				  	if(map.get("title")!=null) title = map.get("title").toString();
				  	if(map.get("state")!=null) state = map.get("state").toString();
				  	if(map.get("in_date")!=null) in_datex = map.get("in_date").toString();
						if(in_datex.length()>10) in_datex=in_datex.substring(0,10);
						
						String stateStr = "";
						if(state != null && !state.equals("")){
							if(state.equals("0")){
								stateStr = "<a href=index.jsp?abinfo_state="+state+">"+"显示</a>";
							}else if(state.equals("1")){
								stateStr = "<a href=index.jsp?abinfo_state="+state+">"+"隐藏</a>";
							}
						}

						
						
						List listt = new ArrayList();
						String trr[] = ch_attr.split("\\|");
                        String newchattr = "";						
						if(!ch_attr.equals("")){
						for(int j=0;j<trr.length;j++){
							newchattr += "<a href=index.jsp?ch_attr=" + trr[j] + ">" + ti_aboutchannelInfo.getChName(trr[j]) + "</a>&nbsp;";
							}
						}
					
						
		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=info_id %>" /></td>
			
		  	<td><a href="updateInfo.jsp?info_id=<%=info_id %>&ch_attr=<%=n_ch_attr%>&abinfo_state=<%=n_info_state%>&searchTitle=<%=titlex%>&iStart=<%=Integer.parseInt(iStart)%>"><%=title%><a></td>
		  	
		  	<td><%=newchattr%></td>
		  	
		  	<td><%=stateStr%></td>
		  	
		  	<td><%=in_datex%></td>
		  	
			<td width="10%"><a href="updateInfo.jsp?info_id=<%=info_id %>&<%=para%>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:deleteOneInfo('<%=info_id%>','9956');"><img src="/program/admin/images/delete.gif" title="删除" /></a></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="9956" />
	  </form>
</body>

</html>
